library(stargazer)
library(tidyverse)
library(patchwork)
library(plotly)Results
Imports
load("data/models.RData")wahl_lohn <- readRDS("data/wahl_lohn_mod.rds")Plots
Basic plot with SB
plot_basic <- ggplot(aes(x = lohn_prozent, y = afd_prozent, label=name), data = wahl_lohn) +
geom_point(shape = 1) +
geom_smooth(method = "lm", se = T) +
labs(
x = "Minimum Wage Share",
y = "AfD Vote Share",
subtitle = "District Level",
caption = "Data: WSI, Bundeswahlleiter"
) +
theme_gray() #+ #scientific theme
#coord_cartesian(xlim = c(0, 0.5), ylim = c(0, 0.35)) + #start at 0,0
# for Sonneberg (16072)
# geom_point(
# data = wahl_lohn %>% filter("kreis" == "16072"),
# color = "red",
# ) +
# geom_text(
# data = wahl_lohn %>% filter("kreis" == "16072"),
# label = "SB",
# vjust = 1.3,
# hjust = 0,
# color = "red"
# )
ggsave("images/plot_basic.png", plot_basic, width = 10, height = 7)`geom_smooth()` using formula 'y ~ x'
#plotly::ggplotly(plot_basic)
plot_basic`geom_smooth()` using formula 'y ~ x'

Plot with east germany
ggplot(aes(x = lohn_prozent, y = afd_prozent), data = wahl_lohn) +
geom_point(aes(color = factor(ost))) +
geom_smooth(method = "lm") +
labs(
x = "Anteil Mindestlohnbezieher",
y = "AfD Stimmen in %",
title = "AfD Stimmen und Mindestlohnbezieher",
subtitle = "Kreisebene",
caption = "Daten: WSI, Bundeswahlleiter"
) +
scale_color_manual(values = c("red", "blue"), name="Osten") + #color of points
theme_minimal() + #scientific theme
coord_cartesian(xlim = c(0, 0.5), ylim = c(0, 0.35)) #start at 0,0`geom_smooth()` using formula 'y ~ x'

Plot with scale for arbeitslosenquote
ggplot(aes(x = lohn_prozent, y = afd_prozent), data = wahl_lohn) +
geom_point(aes(color = arbeitslosenquote)) +
geom_smooth(method = "lm") +
labs(
x = "Anteil Mindestlohnbezieher",
y = "AfD Stimmen in %",
title = "AfD Stimmen und Mindestlohnbezieher",
subtitle = "Kreisebene",
caption = "Daten: WSI, Bundeswahlleiter"
) +
scale_color_viridis_c(name = "Arbeitslosenquote", option="magma", direction=-1) + #color of points
theme_minimal() + #scientific theme
coord_cartesian(xlim = c(0, 0.5), ylim = c(0, 0.35)) #start at 0,0`geom_smooth()` using formula 'y ~ x'

Plot for linkspartei
ggplot(aes(x = lohn_prozent, y = linke_prozent), data = wahl_lohn) +
geom_point() +
geom_smooth(method = "lm") +
theme_minimal() #scientific theme`geom_smooth()` using formula 'y ~ x'
Warning: Removed 1 rows containing non-finite values (stat_smooth).
Warning: Removed 1 rows containing missing values (geom_point).

Maps
Load GEOJSON Data for Kreise
Data Source = Regionalatlas Statistikportal
spdf <- sf::read_sf("data/kreise.geojson")Merge
geodata <- spdf %>%
left_join(wahl_lohn, by = c("schluessel" = "kreis"))Afd Stimmen
afd_map <- ggplot(geodata) +
geom_sf(aes(fill = afd_prozent)) +
scale_fill_viridis_c(name = "AfD in %", option="magma", direction=-1) +
theme_minimal() +
labs(
title = "AfD Vote Share",
subtitle = "District Level",
caption = "Data: Bundeswahlleiter"
)Mindestlohn
lohn_map <- ggplot(geodata) +
geom_sf(aes(fill = lohn_prozent)) +
scale_fill_viridis_c(name = "MW %", option="magma", direction=-1) +
theme_minimal() +
labs(
title = "Minimum Wage Recipients",
subtitle = "District Level",
caption = "Data: WSI"
)both maps next to each other
maps <- afd_map + lohn_map
ggsave("images/maps.png",plot=maps, width = 10, height = 5)subplot(ggplotly(afd_map), ggplotly(lohn_map))